
#include "stack.h"
#include <stdio.h>

int main()
{
    // 1. 初始化堆栈
    struct stack s;
    stack_init(&s);

    // 2. 入栈
    s.push(&s, 1);
    s.push(&s, 2);
    s.push(&s, 3);
    s.push(&s, 4);
    s.push(&s, 5);
    s.show(&s);

    // 3. 查看栈顶元素
    int peek;
    peek = s.peek(&s);
    printf("peek = %d\n", peek);

    // 4. 出栈
    s.pop(&s);
    s.show(&s);
    peek = s.peek(&s);
    printf("peek = %d\n", peek);

    return 0;
}

/* 
1 2 3 4 5 
peek = 5
1 2 3 4 
peek = 4
 */